package com.aspose.cells;

class zvp {
   static double a(double var0) {
      return var0 > 0.0D ? Math.floor(var0 + 0.5D) : Math.ceil(var0 - 0.5D);
   }

   static double a(DateTime var0, DateTime var1) {
      com.aspose.cells.b.a.zk var2 = var1.a(var0);
      return (double)var2.b();
   }

   static double b(DateTime var0, DateTime var1) {
      double var2 = (double)(var1.getYear() - var0.getYear());
      double var4 = (double)(var1.getMonth() - var0.getMonth());
      double var6 = (double)(var1.getDay() - var0.getDay());
      return var2 * 360.0D + var4 * 30.0D + var6;
   }

   static double c(DateTime var0, DateTime var1) {
      DateTime var2 = var0;
      DateTime var3 = var1;
      if (var0.getDay() > 28 && var0.getMonth() == 2) {
         var2 = new DateTime(var0.getYear(), var0.getMonth(), 28);
      }

      if (var1.getDay() > 28 && var1.getMonth() == 2) {
         var3 = new DateTime(var1.getYear(), var1.getMonth(), 28);
      }

      DateTime var4 = new DateTime(var3.getYear(), var2.getMonth(), var2.getDay());
      return (double)((var3.getYear() - var2.getYear()) * 365) + a(var4, var3);
   }

   static double a(DateTime var0, DateTime var1, byte var2) {
      int var3 = var1.getDay();
      int var4 = var0.getDay();
      if (a(var1) && (a(var0) || var2 == 1)) {
         var3 = 30;
      }

      if (var3 == 31 && (var0.getDay() >= 30 || var2 == 1)) {
         var3 = 30;
      }

      if (var0.getDay() == 31) {
         var4 = 30;
      }

      if (a(var0)) {
         var4 = 30;
      }

      return b(new DateTime(var0.getYear(), var0.getMonth(), var4), new DateTime(var1.getYear(), var1.getMonth(), var3));
   }

   static double d(DateTime var0, DateTime var1) {
      int var2 = var1.getDay();
      int var3 = var0.getDay();
      if (var3 == 31) {
         var3 = 30;
      }

      if (var2 == 31) {
         var2 = 30;
      }

      return b(new DateTime(var0.getYear(), var0.getMonth(), var3), new DateTime(var1.getYear(), var1.getMonth(), var2));
   }

   static boolean a(DateTime var0) {
      return var0.getMonth() == 2 && b(var0);
   }

   static boolean b(DateTime var0) {
      int var1 = var0.getMonth();
      var0 = var0.addDays(1.0D);
      return var0.getMonth() != var1;
   }

   static double a(DateTime var0, int var1) {
      if (var1 == 1) {
         return b((double)var0.getYear()) ? 366.0D : 365.0D;
      } else {
         return a(var0, var0, var1);
      }
   }

   static boolean b(double var0) {
      return var0 % 4.0D == 0.0D && var0 % 100.0D != 0.0D || var0 % 400.0D == 0.0D;
   }

   static double a(DateTime var0, DateTime var1, int var2) {
      switch(var2) {
      case 0:
         return 360.0D;
      case 1:
         if (!e(var0, var1)) {
            double var3 = (double)(var1.getYear() - var0.getYear() + 1);
            double var5 = a(new DateTime(var0.getYear(), 1, 1), new DateTime(var1.getYear() + 1, 1, 1));
            return var5 / var3;
         } else {
            if (f(var0, var1)) {
               return 366.0D;
            }

            return 365.0D;
         }
      case 2:
         return 360.0D;
      case 3:
         return 365.0D;
      case 4:
         return 360.0D;
      default:
         return 360.0D;
      }
   }

   static double a(DateTime var0, DateTime var1, byte var2, int var3) {
      double var4 = 0.0D;
      switch(var3) {
      case 0:
         var4 = a(var0, var1, (byte)0);
         break;
      case 1:
         var4 = a(var0, var1);
         break;
      case 2:
         if (var2 == 1) {
            var4 = a(var0, var1);
         } else {
            var4 = a(var0, var1, (byte)0);
         }
         break;
      case 3:
         if (var2 == 1) {
            var4 = a(var0, var1);
         } else {
            var4 = c(var0, var1);
         }
         break;
      case 4:
         var4 = d(var0, var1);
      }

      return var4;
   }

   static boolean e(DateTime var0, DateTime var1) {
      return var0.getYear() == var1.getYear() || var1.getYear() == var0.getYear() + 1 && (var0.getMonth() > var1.getMonth() || var0.getMonth() == var1.getMonth() && var0.getDay() >= var1.getDay());
   }

   static boolean f(DateTime var0, DateTime var1) {
      return var0.getYear() == var1.getYear() && b((double)var0.getYear()) || var1.getMonth() == 2 && var1.getDay() == 29 || g(var0, var1);
   }

   static boolean g(DateTime var0, DateTime var1) {
      if (var0.getYear() == var1.getYear() && b((double)var0.getYear())) {
         return var0.getMonth() <= 2 && var1.getMonth() > 2;
      } else if (var0.getYear() == var1.getYear()) {
         return false;
      } else if (var1.getYear() == var0.getYear() + 1) {
         if (b((double)var0.getYear())) {
            return var0.getMonth() <= 2;
         } else if (b((double)var1.getYear())) {
            return var1.getMonth() > 2;
         } else {
            return false;
         }
      } else {
         return false;
      }
   }

   private static DateTime a(DateTime var0, DateTime var1, int var2, int var3, double var4, boolean var6) {
      boolean var7 = false;
      if (var2 > 0) {
         var7 = !com.aspose.cells.a.c.zk.a(var0, var1);
      } else {
         var7 = !com.aspose.cells.a.c.zk.a(var1, var0);
      }

      if (var7) {
         return var0;
      } else {
         DateTime var8 = var1;
         DateTime var9 = var1;

         while(com.aspose.cells.a.c.zk.b(var8, var0)) {
            var9 = var8;
            var8 = a(var8, var2, var3, var6);
            if (com.aspose.cells.a.c.zk.a(var8, var1)) {
               break;
            }
         }

         return var9;
      }
   }

   private static DateTime g(DateTime var0, DateTime var1, int var2, int var3) {
      boolean var4 = b(var1);
      int var5 = -12 / var2;
      boolean var6 = false;
      if (var5 > 0) {
         var6 = !com.aspose.cells.a.c.zk.a(var0, var1);
      } else {
         var6 = !com.aspose.cells.a.c.zk.a(var1, var0);
      }

      if (var6) {
         return var0;
      } else {
         DateTime var7 = var1;

         while(com.aspose.cells.a.c.zk.b(var7, var0)) {
            var7 = b(var7, var5, var3, var4);
            if (com.aspose.cells.a.c.zk.a(var7, var1)) {
               var7 = var0;
               break;
            }
         }

         return var7;
      }
   }

   private static double d(DateTime var0, DateTime var1, int var2) {
      DateTime var3 = g(var0, var1, var2, 1);
      DateTime var4 = h(var0, var1, var2, 1);
      return a(var3, var4);
   }

   private static DateTime h(DateTime var0, DateTime var1, int var2, int var3) {
      boolean var4 = false;
      int var5 = a(var0.getYear(), var0.getMonth());
      if (var5 == var0.getDay()) {
         var4 = true;
      }

      int var6 = -12 / var2;
      return a(var0, var1, var6, var3, 0.0D, var4);
   }

   private static int a(int var0, int var1) {
      if (var1 != 12) {
         DateTime var2 = new DateTime(var0, var1 + 1, 1);
         return var2.addDays(-1.0D).getDay();
      } else {
         return 31;
      }
   }

   private static DateTime a(DateTime var0, int var1, int var2, boolean var3) {
      DateTime var4 = var0.addMonths(var1);
      if (b(var0) && var2 == 1 && !b(var4)) {
         int var5 = a(var4.getYear(), var4.getMonth());
         return new DateTime(var4.getYear(), var4.getMonth(), var5);
      } else {
         return var4;
      }
   }

   private static DateTime b(DateTime var0, int var1, int var2, boolean var3) {
      DateTime var4 = var0.addMonths(var1);
      if (var3 && b(var0) && var2 == 1 && !b(var4)) {
         int var5 = a(var4.getYear(), var4.getMonth());
         return new DateTime(var4.getYear(), var4.getMonth(), var5);
      } else {
         return var4;
      }
   }

   static Object a(DateTime var0, DateTime var1, DateTime var2, double var3, double var5, int var7, int var8) {
      if (var3 > 0.0D && var5 > 0.0D) {
         if (var7 != 1 && var7 != 2 && var7 != 4) {
            return zst.f;
         } else if (var8 >= 0 && var8 <= 4) {
            if (com.aspose.cells.a.c.zk.a(var0, var2)) {
               return zst.f;
            } else {
               int var10 = 12 / var7;
               int var11 = -var10;
               new DateTime();
               boolean var10000 = var1.getDay() == a(var1.getYear(), var1.getMonth());
               DateTime var12;
               if (com.aspose.cells.a.c.zk.b(var2, var1)) {
                  var12 = g(var1, var2, var10, var8);
               } else {
                  var12 = a(var1, var11, var8, false);
               }

               h(var1, var2, var7, var8);
               DateTime var15 = com.aspose.cells.a.c.zk.b(var0, var12) ? var0 : var12;
               double var16 = a(var15, var2, (byte)1, var8);
               Object var18 = b(var12, var1, var7, var8);
               if (var18 instanceof zst) {
                  return var18;
               } else {
                  double var19 = (Double)var18;
                  double var21 = var16 / var19;
                  if (com.aspose.cells.a.c.zk.b(var12, var0)) {
                     if (var8 == 0) {
                        int var23 = com.aspose.cells.a.c.zk.b(var0, var12) ? 0 : 1;
                        var16 = a(var0, var15, (byte)var23) - 1.0D;
                     } else {
                        var16 = a(var0, var15, (byte)1, var8);
                     }

                     if (var8 == 0) {
                        var19 = (Double)b(var12, var1, var7, var8);
                     } else if (var8 == 2) {
                        var19 = (Double)b(var12, var1, var7, var8);
                     } else if (var8 == 3) {
                        var19 = 365.0D / (double)var7;
                     } else {
                        var19 = (Double)b(var12, var1, var7, var8) - 2.0D;
                     }

                     var21 += var16 / var19;
                  }

                  return var5 * var3 / (double)var7 * var21;
               }
            }
         } else {
            return zst.f;
         }
      } else {
         return zst.f;
      }
   }

   static Object a(DateTime var0, DateTime var1, double var2, double var4, int var6) {
      if (var2 > 0.0D && var4 > 0.0D && !com.aspose.cells.a.c.zk.a(var0, var1) && var6 >= 0 && var6 <= 4) {
         double var7 = a(var0, var1, (byte)1, var6);
         double var9 = a(var0, var1, var6);
         return var4 * var2 * var7 / var9;
      } else {
         return zst.f;
      }
   }

   static DateTime b(DateTime var0, int var1) {
      return (var1 == 1 || var1 == 3) && b((double)var0.getYear()) && var0.getMonth() == 2 && var0.getDay() >= 28 ? new DateTime(var0.getYear(), var0.getMonth(), 28) : var0;
   }

   static double c(double var0) {
      if (var0 >= 3.0D && var0 <= 4.0D) {
         return 1.5D;
      } else if (var0 >= 5.0D && var0 <= 6.0D) {
         return 2.0D;
      } else {
         return var0 > 6.0D ? 2.5D : 1.0D;
      }
   }

   static Object a(double var0, DateTime var2, DateTime var3, double var4, double var6, double var8, int var10) {
      if (var0 >= 0.0D && var4 >= 0.0D && var4 < var0 && var6 >= 0.0D && !com.aspose.cells.a.c.zk.a(var2, var3) && var8 >= 0.0D && var10 != 2) {
         double var11 = 1.0D / var8;
         if (var11 > 0.0D && var11 < 3.0D || var11 > 4.0D && var11 < 5.0D) {
            return zst.f;
         } else {
            double var13 = Math.ceil(1.0D / var8);
            if (var0 != var4 && var6 <= var13) {
               double var15 = c(var13);
               double var17 = var8 * var15;
               double var19 = a(var2, var10);
               DateTime var21 = b(var2, var10);
               DateTime var22 = b(var3, var10);
               double var23 = a(var21, var22, (byte)1, var10);
               double var25 = var23 / var19 * var17 * var0;
               double var27 = 0.0D;
               if (var25 == 0.0D) {
                  var27 = var0 * var17;
               } else {
                  var27 = var25;
               }

               double var29 = 0.0D;
               if (var25 == 0.0D) {
                  var29 = var13;
               } else {
                  var29 = var13 + 1.0D;
               }

               double var31 = var0 - var4;
               double var33 = 0.0D;
               if (var27 > var31) {
                  var33 = var31;
               } else {
                  var33 = var27;
               }

               double var35 = a(var33);
               double var37 = 0.0D;
               if (var6 == 0.0D) {
                  var37 = var35;
               } else {
                  var37 = a(1.0D, 0.0D, var17, var0 - var35, var29, var6, var4);
               }

               return var37;
            } else {
               return 0;
            }
         }
      } else {
         return zst.f;
      }
   }

   static boolean a(double var0, double var2) {
      double var4 = 1.0E-4D;
      return Math.abs(var0 - var2) < var4;
   }

   static double a(double var0, double var2, double var4, double var6, double var8, double var10, double var12) {
      if (var0 > var10) {
         return a(var2);
      } else {
         ++var0;
         double var14 = var8 - var0;
         double var16 = a(var14, 2.0D) ? var6 * 0.5D : var6 * var4;
         var4 = a(var14, 2.0D) ? 1.0D : var4;
         if (var6 < var12) {
            if (var6 - var12 < 0.0D) {
               var2 = 0.0D;
            } else {
               var2 = var6 - var12;
            }
         } else {
            var2 = var16;
         }

         var6 -= var2;
         return a(var0, var2, var4, var6, var8, var10, var12);
      }
   }

   static Object b(double var0, DateTime var2, DateTime var3, double var4, double var6, double var8, int var10) {
      if (var0 >= 0.0D && var4 >= 0.0D && var4 < var0 && var6 >= 0.0D && !com.aspose.cells.a.c.zk.a(var2, var3) && var8 >= 0.0D && var10 != 2) {
         double var11 = Math.ceil(1.0D / var8);
         double var13 = a(var2, var10);
         DateTime var15 = b(var2, var10);
         DateTime var16 = b(var3, var10);
         double var17 = a(var15, var16, (byte)1, var10);
         double var19 = var17 / var13 * var8 * var0;
         double var21 = 0.0D;
         if (var19 == 0.0D) {
            var21 = var0 * var8;
         } else {
            var21 = var19;
         }

         double var23 = 0.0D;
         if (var19 == 0.0D) {
            var23 = var11;
         } else {
            var23 = var11 + 1.0D;
         }

         double var25 = var0 - var4;
         double var27 = 0.0D;
         if (var21 > var25) {
            var27 = var25;
         } else {
            var27 = var21;
         }

         double var29 = 0.0D;
         if (var0 != var4 && var6 <= var23) {
            if (var6 == 0.0D) {
               var29 = var27;
            } else {
               double var31 = var8 * var0;
               double var33 = var0 - var4 - var27;
               var29 = a(1.0D, var31, var33, var6);
            }
         } else {
            var29 = 0.0D;
         }

         return var29;
      } else {
         return zst.f;
      }
   }

   static double a(double var0, double var2, double var4, double var6) {
      if (var0 > var6) {
         return var2;
      } else {
         var2 = var2 > var4 ? var4 : var2;
         double var8 = var4 - var2;
         var4 = var8 < 0.0D ? 0.0D : var8;
         return a(var0 + 1.0D, var2, var4, var6);
      }
   }

   static Object a(DateTime var0, DateTime var1, double var2, double var4, int var6, int var7) {
      return (var6 == 1 || var6 == 2 || var6 == 4) && var2 >= 0.0D && var4 >= 0.0D && !com.aspose.cells.a.c.zk.a(var0, var1) && var7 >= 0 && var7 <= 4 ? a(var0, var1, var2, var4, var6, var7, false) : zst.f;
   }

   static Object b(DateTime var0, DateTime var1, double var2, double var4, int var6, int var7) {
      return (var6 == 1 || var6 == 2 || var6 == 4) && var2 >= 0.0D && var4 >= 0.0D && !com.aspose.cells.a.c.zk.a(var0, var1) && var7 >= 0 && var7 <= 4 ? a(var0, var1, var2, var4, var6, var7, true) : zst.f;
   }

   static Object a(DateTime var0, DateTime var1, int var2, int var3) {
      if ((var2 == 1 || var2 == 2 || var2 == 4) && !com.aspose.cells.a.c.zk.a(var0, var1) && var3 >= 0 && var3 <= 4) {
         double var4 = 0.0D;
         switch(var3) {
         case 0:
            var4 = a(g(var0, var1, var2, var3), var0, (byte)0);
            break;
         case 1:
            var4 = a(g(var0, var1, var2, var3), var0);
            break;
         case 2:
            var4 = a(g(var0, var1, var2, var3), var0);
            break;
         case 3:
            var4 = a(g(var0, var1, var2, var3), var0);
            break;
         case 4:
            var4 = d(g(var0, var1, var2, var3), var0);
         }

         return var4;
      } else {
         return zst.f;
      }
   }

   static Object b(DateTime var0, DateTime var1, int var2, int var3) {
      if ((var2 == 1 || var2 == 2 || var2 == 4) && !com.aspose.cells.a.c.zk.a(var0, var1) && var3 >= 0 && var3 <= 4) {
         double var4 = 0.0D;
         switch(var3) {
         case 0:
            var4 = 360.0D / (double)var2;
            break;
         case 1:
            var4 = d(var0, var1, var2);
            break;
         case 2:
            var4 = 360.0D / (double)var2;
            break;
         case 3:
            var4 = 365.0D / (double)var2;
            break;
         case 4:
            var4 = 360.0D / (double)var2;
         }

         return var4;
      } else {
         return zst.f;
      }
   }

   static Object c(DateTime var0, DateTime var1, int var2, int var3) {
      if ((var2 == 1 || var2 == 2 || var2 == 4) && !com.aspose.cells.a.c.zk.a(var0, var1) && var3 >= 0 && var3 <= 4) {
         double var4 = 0.0D;
         switch(var3) {
         case 0:
            DateTime var6 = g(var0, var1, var2, var3);
            DateTime var7 = h(var0, var1, var2, var3);
            double var8 = a(var6, var7, (byte)1);
            double var10 = a(var6, var0, (byte)0);
            var4 = var8 - var10;
            break;
         case 1:
            var4 = a(var0, h(var0, var1, var2, var3));
            break;
         case 2:
            var4 = a(var0, h(var0, var1, var2, var3));
            break;
         case 3:
            var4 = a(var0, h(var0, var1, var2, var3));
            break;
         case 4:
            var4 = d(h(var0, var1, var2, var3), var0);
         }

         return var4;
      } else {
         return zst.f;
      }
   }

   static double b(DateTime var0, DateTime var1, int var2) {
      double var3 = a(var0, var1, (byte)1, var2);
      return var3 > 0.0D ? var3 : 0.0D;
   }

   static double h(DateTime var0, DateTime var1) {
      double var2 = a(var0, var1, (byte)1);
      return var2 > 0.0D ? var2 : 0.0D;
   }

   static double c(DateTime var0, DateTime var1, int var2) {
      return var2 == 0 ? h(var0, var1) : b(var0, var1, var2);
   }

   static double a(DateTime var0, DateTime var1, int var2, int var3, boolean var4) {
      double var5 = var4 ? 0.0D : 1.0D;
      boolean var7 = var0.getDay() == a(var0.getYear(), var0.getMonth());
      boolean var8 = false;
      if (!var7 && var0.getMonth() != 2 && var0.getDay() > 28 && var0.getDay() < a(var0.getYear(), var0.getMonth())) {
         var8 = var1.getDay() == a(var1.getYear(), var1.getMonth());
      } else {
         var8 = var7;
      }

      DateTime var9 = a(var0, 0, var3, var8);
      if (com.aspose.cells.a.c.zk.d(var1, var9)) {
         double var10000 = var5 + 1.0D;
      }

      a(var9, var2, var3, var8);
      boolean var13 = false;
      if (var2 > 0) {
         var13 = !com.aspose.cells.a.c.zk.a(var0, var1);
      } else {
         var13 = !com.aspose.cells.a.c.zk.a(var1, var0);
      }

      double var14 = 0.0D;
      if (var13) {
         return var14;
      } else {
         for(DateTime var16 = var1; com.aspose.cells.a.c.zk.d(var16, var0); ++var14) {
            var16 = a(var16, var2, var3, var8);
         }

         return var14 - 1.0D;
      }
   }

   static Object a(DateTime var0, DateTime var1, DateTime var2, double var3, double var5, int var7, int var8, int var9) {
      return (var8 == 1 || var8 == 2 || var8 == 4) && var3 >= 0.0D && var5 >= 0.0D && var7 >= 0 && !com.aspose.cells.a.c.zk.c(var1, var0) && !com.aspose.cells.a.c.zk.c(var0, var2) && var9 >= 0 && var9 <= 4 ? a(var0, var1, var2, var3, var5, var7, var8, var9, true) : zst.f;
   }

   static Object b(DateTime var0, DateTime var1, DateTime var2, double var3, double var5, int var7, int var8, int var9) {
      return (var8 == 1 || var8 == 2 || var8 == 4) && var5 >= 0.0D && var3 >= 0.0D && var7 >= 0 && !com.aspose.cells.a.c.zk.c(var1, var0) && !com.aspose.cells.a.c.zk.c(var0, var2) && var9 >= 0 && var9 <= 4 ? a(var0, var1, var2, var3, var5, var7, var8, var9, false) : zst.f;
   }

   static Object a(DateTime var0, DateTime var1, DateTime var2, double var3, double var5, int var7, int var8, int var9, boolean var10) {
      double var11 = (double)var8;
      int var13 = 12 / var8;
      double var15 = (Double)f(var2, var1, var8, var9);
      DateTime var17 = var2;
      double var18 = 0.0D;
      double var20 = 0.0D;
      double var22 = 0.0D;
      double var24 = 0.0D;
      double var26 = 0.0D;

      double var28;
      for(var28 = 1.0D; var28 <= var15; ++var28) {
         DateTime var30 = a(var17, var13, var9, false);
         double var31 = c(var17, var30, var9);
         if (var28 < var15) {
            var22 = var31;
         } else {
            var22 = c(var17, var1, var9);
         }

         if (com.aspose.cells.a.c.zk.d(var30, var0)) {
            var24 = var22;
         } else if (com.aspose.cells.a.c.zk.d(var17, var0)) {
            var24 = b(var17, var0, var9);
         } else {
            var24 = 0.0D;
         }

         DateTime var33 = com.aspose.cells.a.c.zk.b(var0, var17) ? var0 : var17;
         DateTime var34 = com.aspose.cells.a.c.zk.d(var1, var30) ? var1 : var30;
         double var35 = b(var33, var34, var9);
         var17 = var30;
         var18 += var22 / var31;
         var20 += var24 / var31;
         var26 += var35 / var31;
      }

      var28 = 100.0D * var3 / var11;
      double var37 = var18 * var28 + (double)var7;
      double var32 = 0.0D;
      double var38 = 0.0D;
      if (var10) {
         var32 = var26 * var5 / var11 + 1.0D;
         var38 = var20 * var28;
         return var37 / var32 - var38;
      } else {
         var32 = var20 * var28 + var5;
         var38 = var11 / var26;
         return (var37 - var32) / var32 * var38;
      }
   }

   static Object b(DateTime var0, DateTime var1, double var2, double var4, int var6) {
      if (var2 > 0.0D && var4 > 0.0D && var6 >= 0 && var6 <= 4 && !com.aspose.cells.a.c.zk.a(var0, var1)) {
         double var7 = a(var0, var1, var6);
         double var9 = a(var0, var1, (byte)1, var6);
         double var11 = var4 - var2 * var4 * var9 / var7;
         return var11;
      } else {
         return zst.f;
      }
   }

   static Object a(DateTime var0, DateTime var1, double var2) {
      if (var2 > 0.0D && !com.aspose.cells.a.c.zk.b(var0, var1) && !com.aspose.cells.a.c.zk.d(var0.addYears(1), var1)) {
         double var4 = 0.0D;
         double var6 = a(var0, var1);
         if (var6 > 182.0D) {
            double var8 = (100.0D - var2 * 100.0D * var6 / 360.0D) / 100.0D;
            double var10 = 0.0D;
            if (var6 == 366.0D) {
               var10 = 366.0D;
            } else {
               var10 = 365.0D;
            }

            double var12 = Math.pow(var6 / var10, 2.0D) - (2.0D * var6 / var10 - 1.0D) * (1.0D - 1.0D / var8);
            double var14 = Math.sqrt(var12);
            double var16 = 2.0D * var6 / var10 - 1.0D;
            var4 = 2.0D * (var14 - var6 / var10) / var16;
         } else {
            var4 = 365.0D * var2 / (360.0D - var2 * var6);
         }

         return var4;
      } else {
         return zst.f;
      }
   }

   static Object b(DateTime var0, DateTime var1, double var2) {
      if (var2 > 0.0D && !com.aspose.cells.a.c.zk.b(var0, var1) && !com.aspose.cells.a.c.zk.d(var0.addYears(1), var1)) {
         double var4 = 0.0D;
         double var6 = a(var0, var1);
         var4 = 100.0D * (1.0D - var2 * var6 / 360.0D);
         return var4;
      } else {
         return zst.f;
      }
   }

   static Object c(DateTime var0, DateTime var1, double var2) {
      if (var2 > 0.0D && !com.aspose.cells.a.c.zk.a(var0, var1) && !com.aspose.cells.a.c.zk.d(var0.addYears(1), var1)) {
         double var4 = 0.0D;
         double var6 = a(var0, var1);
         var4 = (100.0D - var2) / var2 * 360.0D / var6;
         return var4;
      } else {
         return zst.f;
      }
   }

   static Object c(DateTime var0, DateTime var1, double var2, double var4, int var6) {
      if (var2 > 0.0D && var4 > 0.0D && var6 >= 0 && var6 <= 4 && !com.aspose.cells.a.c.zk.a(var0, var1)) {
         double var7 = a(var0, var1, var6);
         double var9 = a(var0, var1, (byte)1, var6);
         double var11 = (var4 - var2) / var2 * var7 / var9;
         return var11;
      } else {
         return zst.f;
      }
   }

   static Object a(DateTime var0, DateTime var1, DateTime var2, DateTime var3, double var4, double var6, int var8, int var9, int var10) {
      zasa var11 = new zasa(var0, var1, var2, var3, var4, var8, var9, var10, var6, 0.05D);
      Object var12 = var11.c(0.05D);
      return var12 instanceof zst ? zst.i : var12;
   }

   static Object b(DateTime var0, DateTime var1, DateTime var2, DateTime var3, double var4, double var6, int var8, int var9, int var10) {
      if ((var9 == 1 || var9 == 2 || var9 == 4) && var4 >= 0.0D && var6 >= 0.0D && var8 >= 0 && !com.aspose.cells.a.c.zk.c(var1, var3) && !com.aspose.cells.a.c.zk.c(var3, var0) && !com.aspose.cells.a.c.zk.c(var0, var2) && var10 >= 0 && var10 <= 4) {
         double var10000 = (double)a(var1.getYear(), var1.getMonth());
         int var13 = 12 / var9;
         int var14 = -var13;
         double var15 = (Double)b(var0, var1, var9, var10);
         double var17 = (Double)f(var0, var1, var9, var10);
         double var19 = (double)var9;
         double var21 = b(var2, var3, var10);
         double var23;
         double var37;
         double var42;
         if (var21 < var15) {
            var23 = b(var0, var3, var10);
            double var58 = b(var2, var0, var10);
            double var27 = var6 / var19 + 1.0D;
            double var29 = var23 / var15;
            double var31 = var27;
            double var33 = Math.pow(var27, var17 - 1.0D + var29);
            double var35 = (double)var8 / var33;
            var37 = 100.0D * var4 / var19 * var21 / var15 / Math.pow(var27, var29);
            double var60 = 0.0D;

            for(int var41 = 2; (double)var41 <= var17; ++var41) {
               var42 = 100.0D * var4 / var19 / Math.pow(var31, (double)(var41 - 1) + var29);
               var60 += var42;
            }

            double var62 = var4 / var19;
            double var43 = var58 / var15 * var62 * 100.0D;
            return var35 + var37 + var60 - var43;
         } else {
            var23 = (Double)f(var2, var3, var9, var10);
            DateTime var25 = var3;
            double var26 = 0.0D;
            double var28 = 0.0D;
            double var30 = 0.0D;
            double var32 = 0.0D;

            double var34;
            DateTime var36;
            for(var34 = var23; var34 >= 1.0D; --var34) {
               var36 = a(var25, var14, var10, false);
               var37 = 0.0D;
               if (var10 == 1) {
                  var37 = b(var36, var25, var10);
               } else {
                  var37 = var15;
               }

               if (var34 > 1.0D) {
                  var30 = var37;
               } else {
                  var30 = b(var2, var25, var10);
               }

               DateTime var39 = com.aspose.cells.a.c.zk.b(var2, var36) ? var2 : var36;
               DateTime var40 = com.aspose.cells.a.c.zk.d(var0, var25) ? var0 : var25;
               var32 = b(var39, var40, var10);
               var25 = var36;
               var26 += var30 / var37;
               var28 += var32 / var37;
            }

            var34 = 0.0D;
            if (var10 != 2 && var10 != 3) {
               var36 = (DateTime)d(var0, var3, var9, var10);
               var37 = a(var36, var0, (byte)1, var10);
               var34 = var15 - var37;
            } else {
               var36 = (DateTime)e(var0, var3, var9, var10);
               var34 = b(var0, var36, var10);
            }

            double var59 = a(var3, var0, var13, var10, true);
            double var38 = (Double)f(var3, var1, var9, var10);
            double var61 = var6 / var19 + 1.0D;
            var42 = var34 / var15;
            double var44 = var61;
            double var46 = Math.pow(var61, var42 + var59 + var38);
            double var48 = (double)var8 / var46;
            double var50 = 100.0D * var4 / var19 * var26 / Math.pow(var61, var59 + var42);
            double var52 = 0.0D;

            for(int var54 = 1; (double)var54 <= var38; ++var54) {
               double var55 = 100.0D * var4 / var19 / Math.pow(var44, (double)var54 + var59 + var42);
               var52 += var55;
            }

            double var57 = 100.0D * var4 / var19 * var28;
            return var48 + var50 + var52 - var57;
         }
      } else {
         return zst.f;
      }
   }

   static Object a(DateTime var0, DateTime var1, double var2, double var4, int var6, int var7, int var8, boolean var9) {
      if ((var7 == 1 || var7 == 2 || var7 == 4) && var2 >= 0.0D && var6 > 0 && !com.aspose.cells.a.c.zk.a(var0, var1) && var8 >= 0 && var8 <= 4) {
         if (var9 && var4 < 0.0D) {
            return zst.f;
         } else {
            double var10 = (Double)f(var0, var1, var7, var8);
            DateTime var12 = (DateTime)d(var0, var1, var7, var8);
            double var13 = a(var12, var0, (byte)1, var8);
            double var15 = (Double)b(var0, var1, var7, var8);
            double var17 = var15 - var13;
            double var19 = 100.0D * var2 / (double)var7;
            double var21 = var19 * var13 / var15;
            double var23 = 0.0D;
            if (var10 == 1.0D) {
               var23 = ((double)var6 + var19) / (1.0D + var17 / var15 * var4 / (double)var7) - var21;
            } else {
               double var25 = (double)var6 / Math.pow(1.0D + var4 / (double)var7, var10 - 1.0D + var17 / var15);
               double var27 = 0.0D;

               for(int var29 = 1; (double)var29 <= var10; ++var29) {
                  var27 += var19 / Math.pow(1.0D + var4 / (double)var7, (double)(var29 - 1) + var17 / var15);
               }

               var23 = var25 + var27 - var21;
            }

            return var23;
         }
      } else {
         return zst.f;
      }
   }

   static Object a(DateTime var0, DateTime var1, DateTime var2, double var3, double var5, int var7) {
      if (var3 >= 0.0D && var5 >= 0.0D && !com.aspose.cells.a.c.zk.a(var0, var1) && var7 >= 0 && var7 <= 4) {
         double var8 = a(var2, var0, var7);
         double var10 = a(var2, var1, (byte)1, var7);
         double var12 = a(var2, var0, (byte)1, var7);
         double var14 = var10 - var12;
         double var16 = 100.0D + var10 / var8 * var3 * 100.0D;
         double var18 = 1.0D + var14 / var8 * var5;
         double var20 = var12 / var8 * var3 * 100.0D;
         return var16 / var18 - var20;
      } else {
         return zst.f;
      }
   }

   static Object b(DateTime var0, DateTime var1, DateTime var2, double var3, double var5, int var7) {
      if (var3 >= 0.0D && var5 > 0.0D && !com.aspose.cells.a.c.zk.a(var0, var1) && var7 >= 0 && var7 <= 4) {
         double var8 = a(var2, var0, var7);
         double var10 = a(var2, var1, (byte)1, var7);
         double var12 = a(var2, var0, (byte)1, var7);
         double var14 = var10 - var12;
         double var16 = var10 / var8 * var3 + 1.0D - var5 / 100.0D - var12 / var8 * var3;
         double var18 = var5 / 100.0D + var12 / var8 * var3;
         double var20 = var8 / var14;
         return var16 / var18 * var20;
      } else {
         return zst.f;
      }
   }

   static Object a(DateTime var0, DateTime var1, double var2, double var4, double var6, int var8, int var9) {
      if ((var8 == 1 || var8 == 2 || var8 == 4) && var2 >= 0.0D && var4 > 0.0D && var6 > 0.0D && !com.aspose.cells.a.c.zk.a(var0, var1) && var9 >= 0 && var9 <= 4) {
         double var10 = (Double)f(var0, var1, var8, var9);
         double var12 = 0.0D;
         if (var10 <= 1.0D) {
            DateTime var27 = (DateTime)d(var0, var1, var8, var9);
            double var28 = a(var27, var0, (byte)1, var9);
            double var17 = (Double)b(var0, var1, var8, var9);
            double var19 = var17 - var28 + 1.0D;
            double var23 = var6 / 100.0D + var2 / (double)var8 - (var4 / 100.0D + var28 / var17 * var2 / (double)var8);
            double var25 = var4 / 100.0D + var28 / var17 * var2 / (double)var8;
            var12 = var23 / var25 * (double)var8 * var17 / var19;
            return var12;
         } else {
            zcfy var14 = new zcfy(var0, var1, var2, (int)var6, var8, var9, var4, 0.001D);
            Object var15 = var14.c(0.05D);
            return var15 instanceof zst ? zst.i : var15;
         }
      } else {
         return zst.f;
      }
   }

   static double a(DateTime var0, DateTime var1, double var2, double var4, int var6, int var7, boolean var8) {
      double var9 = (Double)a(var0, var1, var6, var7);
      double var11 = (Double)b(var0, var1, var6, var7);
      double var13 = (Double)f(var0, var1, var6, var7);
      double var15 = var11 - var9;
      double var17 = var15 / var11;
      double var19 = var17 + var13 - 1.0D;
      double var21 = var4 / (double)var6 + 1.0D;
      double var23 = Math.pow(var21, var19);
      double var25 = var19 * 100.0D / var23;
      double var27 = 100.0D / var23;
      double var29 = 0.0D;
      double var31 = 0.0D;

      for(int var33 = 1; (double)var33 <= var13; ++var33) {
         double var34 = (double)(var33 - 1) + var17;
         double var36 = Math.pow(var21, var34);
         double var38 = 100.0D * var2 / (double)var6 / var36;
         var29 += var38 * var34;
         var31 += var38;
      }

      double var40 = var25 + var29;
      double var35 = var27 + var31;
      return var8 ? var40 / var35 / (double)var6 / var21 : var40 / var35 / (double)var6;
   }

   static Object d(DateTime var0, DateTime var1, int var2, int var3) {
      return (var2 == 1 || var2 == 2 || var2 == 4) && !com.aspose.cells.a.c.zk.a(var0, var1) && var3 >= 0 && var3 <= 4 ? g(var0, var1, var2, var3) : zst.f;
   }

   static Object e(DateTime var0, DateTime var1, int var2, int var3) {
      return (var2 == 1 || var2 == 2 || var2 == 4) && !com.aspose.cells.a.c.zk.a(var0, var1) && var3 >= 0 && var3 <= 4 ? h(var0, var1, var2, var3) : zst.f;
   }

   static Object f(DateTime var0, DateTime var1, int var2, int var3) {
      if ((var2 == 1 || var2 == 2 || var2 == 4) && !com.aspose.cells.a.c.zk.a(var0, var1) && var3 >= 0 && var3 <= 4) {
         DateTime var4 = g(var0, var1, var2, var3);
         double var5 = (double)((var1.getYear() - var4.getYear()) * 12 + (var1.getMonth() - var4.getMonth()));
         return var5 * (double)var2 / 12.0D;
      } else {
         return zst.f;
      }
   }

   static double a(double var0, double var2, double var4, double var6, double var8) {
      double var10 = 0.0D;
      if (var0 == 0.0D) {
         var10 = -var6 - var4 * var2;
      } else {
         double var12 = zbc.g(1.0D + var0, var2);
         var10 = -var6 * var12;
         var10 -= var4 * (1.0D + var8 * var0) * (var12 - 1.0D) / var0;
      }

      return var10;
   }

   static double b(double var0, double var2, double var4, double var6, double var8) {
      double var10 = 0.0D;
      if (var0 == 0.0D) {
         var10 = -var6 - var4 * var2;
      } else {
         var10 = -var6;
         double var12 = Math.pow(1.0D + var0, var2);
         if (Double.isInfinite(var12)) {
            var10 = -var4 * (1.0D + var0 * var8) / var0;
         } else {
            var10 -= var4 * (1.0D + var8 * var0) * ((var12 - 1.0D) / var0);
            var10 /= var12;
         }
      }

      return var10;
   }

   static double a(double var0, double var2, double var4, double var6, double var8, double var10) {
      double var12 = c(var0, var4, var6, var8, var10);
      double var14 = var12;
      double var16 = 0.0D;
      if (var10 == 1.0D) {
         --var2;
         var6 += var12;
      }

      for(int var18 = 0; (double)var18 < var2; ++var18) {
         var16 = var6 * var0;
         var14 = var12 + var16;
         var6 += var14;
      }

      return var14;
   }

   static double b(double var0, double var2, double var4, double var6, double var8, double var10) {
      double var12 = c(var0, var4, var6, var8, var10);
      double var14 = 0.0D;
      double var16 = 0.0D;
      if (var10 == 1.0D) {
         --var2;
         var6 += var12;
      }

      for(int var18 = 0; (double)var18 < var2; ++var18) {
         var16 = var6 * var0;
         var14 = var12 + var16;
         var6 += var14;
      }

      return -var16;
   }

   static double c(double var0, double var2, double var4, double var6, double var8) {
      double var10 = 0.0D;
      if (var0 == 0.0D) {
         var10 = -(var6 + var4) / var2;
      } else {
         double var12 = Math.pow(1.0D + var0, var2);
         if (Double.isInfinite(var12)) {
            var10 = -var4 * var0 / (1.0D + var0 * var8);
         } else {
            var10 = -var6;
            var10 = (var10 - var4 * var12) / ((1.0D + var8 * var0) * ((var12 - 1.0D) / var0));
         }
      }

      return var10;
   }

   static Object c(double var0, double var2, double var4, double var6, double var8, double var10) {
      if (var4 + var6 + var2 * var0 == 0.0D) {
         return 0.0D;
      } else {
         zayf var12 = new zayf();
         if (var2 < 0.0D && var6 == 0.0D) {
            double var13 = -var2 / var4;
            if (Math.abs(var13) < Math.abs(var10)) {
               var10 = var13;
            }
         }

         Object var15 = var12.a(var0, var2, var4, var6, var8, var10);
         return var15;
      }
   }

   static double d(double var0, double var2, double var4, double var6, double var8) {
      double var10 = 0.0D;
      var10 = (var2 * (1.0D + var0 * var8) / var0 - var6) / (var4 + var2 * (1.0D + var0 * var8) / var0);
      return com.aspose.cells.b.a.zq.a(var10, 1.0D + var0);
   }

   static Object e(double var0, double var2, double var4, double var6, double var8) {
      if (var6 > var4 + 1.0D) {
         return zst.f;
      } else if (var6 > var4 && var8 == 12.0D) {
         return zst.f;
      } else if (var0 == 0.0D) {
         return 0.0D;
      } else {
         double var10 = 1.0D - Math.pow(var2 / var0, 1.0D / var4);
         var10 = Math.floor(var10 * 1000.0D + 0.5D) / 1000.0D;
         double var12 = var0 * var10 * var8 / 12.0D;
         if (var6 <= 1.0D) {
            return var12 * var6;
         } else {
            for(int var14 = 2; (double)var14 < var6; ++var14) {
               var12 += (var0 - var12) * var10;
            }

            return var6 > var4 ? (var0 - var12) * var10 * (12.0D - var8) / 12.0D : (var0 - var12) * var10;
         }
      }
   }

   static Object f(double var0, double var2, double var4, double var6, double var8) {
      if (var6 >= var4 + 1.0D) {
         return zst.f;
      } else {
         double var10 = var8 / var4;
         double var12 = 0.0D;
         double var14 = 0.0D;
         int var16 = (int)(var6 + 0.5D);

         for(int var17 = 1; var17 <= var16; ++var17) {
            var14 = Math.min((var0 - var12) * var10, var0 - var12 - var2);
            var12 += var14;
         }

         return var14 - var14 * (var6 - (double)var16);
      }
   }

   static double a(double var0, double var2, double var4, double var6, double var8, double var10, boolean var12) {
      if (var8 > var4 + 1.0D) {
         return 0.0D;
      } else {
         double var13 = var10 / var4;
         double var15 = 0.0D;
         double var17 = 0.0D;
         double var19 = 0.0D;
         int var21 = (int)(var8 + 0.5D);

         for(int var22 = 1; var22 <= var21; ++var22) {
            var19 = Math.min((var0 - var15) * var13, var0 - var15 - var2);
            if (var6 < (double)var22) {
               var17 += var19;
            }

            var15 += var19;
         }

         return var17 - var19 * ((double)var21 - var8);
      }
   }

   static Object d(DateTime var0, DateTime var1, double var2, double var4, int var6) {
      if (var2 > 0.0D && var4 > 0.0D && var6 >= 0 && var6 <= 4 && !com.aspose.cells.a.c.zk.a(var0, var1)) {
         double var7 = a(var0, var1, var6);
         double var9 = a(var0, var1, (byte)1, var6);
         double var11 = 1.0D - var2 / var4;
         double var13 = var11 * var7 / var9;
         return var13;
      } else {
         return zst.f;
      }
   }

   static Object b(double var0, double var2) {
      if (var2 < 0.0D) {
         return zst.f;
      } else if (var2 == 0.0D) {
         return zst.a;
      } else {
         double var4 = (double)((int)var0);
         double var6 = var0 % 1.0D;
         double var8 = var4 + var6 / var2 * 100.0D;
         return var8;
      }
   }

   static Object c(double var0, double var2) {
      if (var2 < 0.0D) {
         return zst.f;
      } else if (var2 == 0.0D) {
         return zst.a;
      } else {
         double var4 = (double)((int)var0);
         double var6 = var0 % 1.0D;
         double var8 = var4 + var6 * var2 / 100.0D;
         return var8;
      }
   }

   static Object a(double var0, int var2) {
      if (var0 > 0.0D && var2 >= 1) {
         double var3 = Math.pow(1.0D + var0 / (double)var2, (double)var2) - 1.0D;
         return var3;
      } else {
         return zst.f;
      }
   }

   static Object b(double var0, int var2) {
      if (var0 > 0.0D && var2 >= 1) {
         double var3 = Math.pow(var0 + 1.0D, 1.0D / (double)var2);
         double var5 = (var3 - 1.0D) * (double)var2;
         return var5;
      } else {
         return zst.f;
      }
   }

   static Object e(DateTime var0, DateTime var1, double var2, double var4, int var6) {
      if (var2 > 0.0D && var4 > 0.0D && var6 >= 0 && var6 <= 4 && !com.aspose.cells.a.c.zk.a(var0, var1)) {
         double var7 = a(var0, var1, var6);
         double var9 = a(var0, var1, (byte)1, var6);
         double var11 = (var4 - var2) / var2 * var7 / var9;
         return var11;
      } else {
         return zst.f;
      }
   }

   static Object f(DateTime var0, DateTime var1, double var2, double var4, int var6) {
      if (var2 > 0.0D && var4 > 0.0D && var6 >= 0 && var6 <= 4 && !com.aspose.cells.a.c.zk.a(var0, var1)) {
         double var7 = a(var0, var1, var6);
         double var9 = a(var0, var1, (byte)1, var6);
         double var11 = var4 * var9 / var7;
         double var13 = var2 / (1.0D - var11);
         return var13;
      } else {
         return zst.f;
      }
   }

   static double a(double var0, double[] var2) {
      double[] var3 = var2;
      int var4 = var2.length;

      for(int var5 = 0; var5 < var4; ++var5) {
         double var6 = var3[var5];
         var0 *= 1.0D + var6;
      }

      return var0;
   }

   static double d(double var0, double var2, double var4, double var6, double var8, double var10) {
      double var12 = 0.0D;
      double var14 = 0.0D;
      double var16 = 0.0D;
      double var18 = c(var0, var2, var4, 0.0D, var10);
      int var20 = 1;
      if (var10 == 1.0D) {
         var4 += var18;
         ++var20;
      }

      for(; var20 <= (int)var8; ++var20) {
         var16 = var4 * var0;
         var12 = var18 + var16;
         var4 += var12;
         if (var6 <= (double)var20) {
            var14 += var16;
         }
      }

      return -var14;
   }

   static double b(double var0, double var2, double var4, double var6) {
      double var8 = var6 / var4;
      return -(var6 - var8 * var2) * var0;
   }

   static Object e(double var0, double var2, double var4, double var6, double var8, double var10) {
      if (var0 > 0.0D && var2 > 0.0D && var4 > 0.0D) {
         double var12 = 0.0D;
         var12 = d(var0, var2, var4, var6, var8, var10);
         return (var8 - var6 + 1.0D) * c(var0, var2, var4, 0.0D, var10) - var12;
      } else {
         return zst.f;
      }
   }

   static double b(double var0, double[] var2) {
      double var3 = var0 + 1.0D;
      double var5 = 0.0D;

      for(int var7 = 0; var7 < var2.length; ++var7) {
         var5 += var2[var7] / var3;
         var3 *= var0 + 1.0D;
      }

      return var5;
   }

   static Object a(double[] var0, double var1, double var3) {
      int var5 = 0;

      for(int var6 = 0; var6 < var0.length; ++var6) {
         if (var0[var6] < 0.0D) {
            ++var5;
         }
      }

      if (var5 != 0 && var5 != var0.length) {
         double[] var14 = new double[var0.length - var5];
         double[] var7 = new double[var5];
         int var8 = 0;
         int var9 = 0;

         for(int var10 = 0; var10 < var0.length; ++var10) {
            if (var0[var10] < 0.0D) {
               var7[var9++] = var0[var10];
            } else {
               var14[var8++] = var0[var10];
            }
         }

         double var15 = -b(var3, var14) * Math.pow(1.0D + var3, (double)var14.length);
         double var12 = b(var1, var7) * (1.0D + var1);
         return Math.pow(var15 / var12, 1.0D / (double)(var0.length - 1)) - 1.0D;
      } else {
         return zst.a;
      }
   }
}
